import type { AxiosRequestConfig } from '@umijs/max';
import { request } from '@umijs/max';

/**
 * @description 下载文件返回ArrayBuffer
 */
export default async function downloadFileReturnBuffer(url: string, config: AxiosRequestConfig) {
  const { method = 'POST', ...otherConfig } = config;
  return request(url, {
    method,
    responseType: 'arraybuffer',
    ...otherConfig,
  });
}
